package com.joysuch.wwyt.risk.entity;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;

import static javax.persistence.GenerationType.IDENTITY;

@Data
@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Entity
@Table(name = "wwyt_risk_point_business_evaluation_item")
@SQLDelete(sql = "update wwyt_risk_point_business_evaluation_item set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_risk_point_business_evaluation_item set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
public class RiskPointEvaluationItem implements Serializable {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @ApiModelProperty("风险辨识评估id")
    private Long id;

    @ApiModelProperty("风险点id")
    private Long riskPointId;

    @ApiModelProperty("0风险点固有风险评价,1风险点控制风险评价")
    private Integer pointAnalyzeType;

    @ApiModelProperty("分析方法id")
    private Long analyzeWayId;

    @ApiModelProperty("评估id")
    private Long pointEvaluationId;

    @ApiModelProperty("评估等级")
    private Integer riskLevel;

    @ApiModelProperty("序号")
    private Integer orderNumber;

    @ApiModelProperty("风险点类别:null风险点;1风险点库")
    private Integer shared;

    @ApiModelProperty("关联的固有itemid")
    private Long stableItemId;

    @ApiModelProperty("控制措施失效数量")
    private Integer controlFailureCount;

    @ApiModelProperty("未检记录json(key:排查计划id value:排查记录itemid")
    private String uncheckedRecordItemJson;

    //通用字段
    @ApiModelProperty("创建人")
    @org.springframework.data.annotation.CreatedBy
    private Long createBy;

    @ApiModelProperty("创建时间")
    @org.springframework.data.annotation.CreatedDate
    private java.time.LocalDateTime createTime;

    @ApiModelProperty("更新人")
    @org.springframework.data.annotation.LastModifiedBy
    private Long updateBy;

    @ApiModelProperty("更新时间")
    @org.springframework.data.annotation.LastModifiedDate
    private java.time.LocalDateTime updateTime;

    @ApiModelProperty("租户")
    private Long tenentId;

    @ApiModelProperty("组织机构代码")
    private String orgCode;

    @ApiModelProperty("删除标记")
    private String deleteFlag;
}
